import mockjs from 'mockjs';

export default {
  'POST /api/monitor/getMakerList': (req, res) => {
    const { size, makerName, makerId } = req.body;
    if (makerId != null && makerId != undefined && makerId != '') {
      res.send(
        mockjs.mock({
          code: 200,
          message: '请求成功',
          data: {
            total: 2,
            page: 1,
            'items|2': [
              {
                'id|+1': 1,
                'makerId|1': '202223251522252',
                makerName: '@name',
                trueName: '@name',
                'unitType|1': ['中国某品牌', '河南某型号', '郑州大学'],
                address: '@county(true)',
                'state|1': [true, false],
                'durableYear|1': [1, 2, 3, 4, 5, 6, 7, 8],
                username: '@name',
                createTime: '@date',
                thresholds: [
                  {
                    name: 'PH',
                    value: [0, 10, 12, 14, 15],
                  },
                  {
                    name: 'MG',
                    value: [0, 10, 12, 14, 55],
                  },
                  {
                    name: 'Fe',
                    value: [0, 10, 12, 14, 55],
                  },
                  {
                    name: 'lu',
                    value: [0, 10, 12, 14, 55],
                  },
                ],
              },
            ],
          },
        }),
      );
    } else {
      res.send(
        mockjs.mock({
          code: 200,
          message: '请求成功',
          data: {
            total: 50,
            page: 5,
            'items|50': [
              {
                'id|+1': 1,
                'markerId|1': '202223251522252',
                markerName: '@name',
                trueName: '@name',
                'unitType|1': ['中国某品牌', '河南某型号', '郑州大学'],
                address: '@county(true)',
                'state|1': [true, false],
                'durableYear|1': [1, 2, 3, 4, 5, 6, 7, 8],
                username: '@name',
                createTime: '@date',
                thresholds: [
                  {
                    name: 'PH',
                    value: [0, 10, 12, 14, 15],
                  },
                  {
                    name: 'MG',
                    value: [0, 10, 12, 14, 55],
                  },
                  {
                    name: 'Fe',
                    value: [0, 10, 12, 14, 55],
                  },
                  {
                    name: 'lu',
                    value: [0, 10, 12, 14, 55],
                  },
                ],
              },
            ],
          },
        }),
      );
    }
    return;
  },
  'POST /api/monitor/insert': (req, res) => {
    res.send({
      code: 200,
      message: '添加成功',
      data: null,
    });
    return;
  },
  'POST /api/monitor/update': (req, res) => {
    res.send({
      code: 200,
      message: '修改成功',
      data: null,
    });
    return;
  },
  'POST /api/monitor/delete': (req, res) => {
    res.send({
      code: 200,
      message: '删除成功',
      data: null,
    });
    return;
  },
};
